package com.cat.DataStructure04;

/**
 * @author 曲大人的喵
 * @description https://leetcode.cn/problems/minimum-length-of-string-after-operations/
 * @create 2025/11/25 16:37
 * @since JDK17
 */

public class Solution09 {
    public int minimumLength(String s) {
        int[] cnt = new int[26];
        for (var x : s.toCharArray()) {
            cnt[x - 'a']++;
        }
        int ans = 0;
        for (var x : cnt) {
            if (x > 0) {
                ans += x % 2 == 1 ? 1 : 2;
            }
        }

        return ans;
    }
}
